package com.cz.nongyetongv5.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.cz.nongyetongv5.R;
import com.cz.nongyetongv5.activity.EntDetailActivity;


/**
 * 签名
 * Created by zhangliang on 2017/6/26.
 */

public class EntInfoSignatureFragment extends Fragment {
    private ImageView iv_singel;
    private  View ll_empty;
    private View view;

    public static EntInfoSignatureFragment newInstance() {
        EntInfoSignatureFragment fragment = new EntInfoSignatureFragment();
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_ent_signature, null);
        iv_singel=view.findViewById(R.id.iv_singel);
        ll_empty=view.findViewById(R.id.ll_empty);
        init();
        return view;
    }



    public void init() {
        if (((EntDetailActivity) getActivity()).getEntBean().getSign() == null || ((EntDetailActivity) getActivity()).getEntBean().getSign().isEmpty()) {
            ll_empty.setVisibility(View.VISIBLE);
            TextView textView = (TextView) ll_empty.findViewById(R.id.tv_hit);
            textView.setText("暂无签名信息");
            iv_singel.setVisibility(View.GONE);
        } else {
            ll_empty.setVisibility(View.GONE);
            iv_singel.setVisibility(View.VISIBLE);
            Glide.with(getActivity())
                    .load(((EntDetailActivity) getActivity()).getEntBean().getSign()).placeholder(R.drawable.ic_launcher).error(R.mipmap.ic_launcher)
                    .into(iv_singel);
        }
    }
}